<!-- BeginDsi "dsi/head.html" -->
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Embedthis GoAhead 3.1.1 Documentation</title>
    <meta name="keywords" content="embedded web server, web server software, embedded HTTP, application web server, 
        embedded server, small web server, HTTP server, library web server, library HTTP, HTTP library" />
    <meta name="description" content="Embedthis Sofware provides commercial and open source embedded web servers for 
        devices and applications." />
	<meta name="robots" content="index,follow" />
	<link href="../../doc.css" rel="stylesheet" type="text/css" />
	<link href="../../print.css" rel="stylesheet" type="text/css" media="print"/>
    <!--[if IE]>
    <link href="../../iehacks.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    <link href="http://www.google.com/cse/style/look/default.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-179169-5']);
        _gaq.push(['_trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
    </script>
</head>

<body>
    <div class="top">
        <a class="logo" href="http://embedthis.com/products/goahead/">&nbsp;</a>
        <div class="topRight">
            <div class="search">
                <div id="cse-search-form"></div>
                <div class="version">Embedthis GoAhead 3.1.1</div>
            </div>
        </div>
        <div class="crumbs">
            <a href="../../index.html">Home</a>
<!-- EndDsi -->
             &gt; <a href="index.html">Programmers Reference</a> &gt; <b>Architecture</b>
        </div>
    </div>
    <div class="content">
        <div class="contentRight">
            <h1>Quick Nav</h1>
            <ul>
                <li><a href="#overview">Overview</a></li>
                <li><a href="#enabling">Enabling Allocator</a></li>
            </ul>
            <h1>See Also</h1>
            <ul>
                <li><a href="../../guide/goahead/overview.html">User Guide Overview</a></li>
                <li><a href="../../guide/goahead/users/authentication.html">Authentication</a></li>
                <li><a href="../../guide/goahead/users/ports.html">Ports and Binding</a></li>
                <li><a href="../../guide/goahead/users/ssl.html">Secure Sockets Layer</a></li>
            </ul>
        </div>
        <div class="contentLeft">
            <h1>Memory Allocator</h1>
            <a id="overview"></a>
            <h2>Overview</h2>
            <p>GoAhead provides an application-specific memory allocator to use instead of malloc. This allocator is 
            useful when the native operating system malloc suffers from excessive fragmentation.
            It is faster than most general purpose malloc allocators for the GoAhead web server  workload. It is
            deterministic and allocates and frees memory in constant time O(1). </p>
            <p>The allocator is optimized for frequent allocations of small blocks (&lt; 4K). It 
            uses a scheme of buddy free queues for fast allocation. Memory allocations are aligned on 16 byte boundaries on
            64-bit systems and otherwise on 8 byte boundaries. It will not return chunks of unused memory back to the O/S.</p>
            <a id="enabling"></a>
            <h3>Enabling the Allocator</h3>
            <p>The allocator is not enabled by default as most operating systems now have suitable malloc implementations.
            To enable, run configure and rebuild:</p>
            <pre>configure --set replaceMalloc=true
bit
</pre>
        </div>
    </div>
<!-- BeginDsi "dsi/bottom.html" -->
	<div class="bottom">
		<p class="footnote"> 
            <a href="../../product/copyright.html" >&copy; Embedthis Software LLC, 2003-2013.
            All rights reserved. Embedthis and Embedthis GoAhead are trademarks of Embedthis Software LLC.</a>
		</p>
	</div>
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript"> 
      google.load('search', '1', {language : 'en'});
      google.setOnLoadCallback(function() {
        var customSearchControl = new google.search.CustomSearchControl(
          '000262706376373952077:1hs0lhenihk');
        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
        var options = new google.search.DrawOptions();
        options.enableSearchboxOnly("http://embedthis.com/search.html");
        customSearchControl.draw('cse-search-form', options);
      }, true);
    </script>
</body>
</html>
